#ifndef _M_LOGGER_H__
#define _M_LOGGER_H__

#include <stdio.h>
#include <time.h>

#define INF 0
#define DBG 1
#define ERR 2
#define DEFAULT_LEVEL INF

#define LOG(lev_str,level,format,...) {\
        if(level >= DEFAULT_LEVEL) {\
            time_t t = time(nullptr);\
            struct tm* ptm = localtime(&t);\
            char time_str[32];\
            strftime(time_str,31,"%H:%M:%S",ptm);\
            printf("[%s][%s][%s:%d] " format "\n", lev_str, time_str,__FILE__,__LINE__,##__VA_ARGS__);\
        }\
    }

#define ILOG(format, ...) LOG("INF", INF, format, ##__VA_ARGS__)
#define DLOG(format, ...) LOG("DBG", DBG, format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG("ERR", ERR, format, ##__VA_ARGS__)


#endif